<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY copy "&#169;">
  <!ENTITY nbsp "&#160;">
  <!ENTITY laquo "&#171;">
  <!ENTITY raquo "&#187;">
]>
<xsl:stylesheet xmlns="http://www.w3.org/1999/xhtml"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

	<xsl:output encoding="UTF-8"
              method="xml"
              omit-xml-declaration="yes"
              indent="no"
              doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
              doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>

	<xsl:variable name="Root" select="/page/settings/url" />
	<xsl:variable name="Files" select="/page/settings/files_url" />
	<xsl:variable name="Images" select="/page/settings/images_url" />
	<xsl:variable name="Settings" select="/page/settings" />
	<xsl:variable name="Controller" select="/page/settings/controller" />
	<xsl:variable name="Action" select="/page/settings/action" />
	<xsl:variable name="This" select="/page/settings/this" />
	<xsl:variable name="Main" select="/page/content/Main" />
	<xsl:variable name="User" select="/page/content/auth-info" />
	<xsl:variable name="Content" select="/page/content" />
	<xsl:variable name="Cats" select="/page/content/Cats" />
	<xsl:variable name="Cat" select="/page/content/@cat" />
	<xsl:variable name="Form" select="/page/content/Main/form" />
	<xsl:variable name="Static" select="/page/content/static" />


	<xsl:template match="/">
		<xsl:apply-templates />
	</xsl:template>

	<xsl:template match="page">
		<html>
		    <head>
		        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		        <title>
		            <xsl:value-of select="$Settings/title"/>
		        </title>
		        <script type="text/javascript" src="/js/jq.js">/**/</script>
		    </head>
		    <body style="margin-left : 7px; margin-right : 0px; margin-top : 0px; margin-bottom : 0px">
		    	<div class="head">
		    		<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
		    			<tr>
							<td width="100%" valign="top" height="100%">
								<table width="100%" cellspacing="0" cellpadding="0" border="0">
									<tr>
										<td>
											<table width="100%" cellspacing="0" cellpadding="0" border="0" background="/images/dazru/topbg.jpg" style="background-position : top; background-repeat : repeat-x ">
												<tr>
													<td height="71px" background="/images/dazru/titleright.jpg" style="background-position : right top; background-repeat : no-repeat ">
														<img border="0" src="/images/dazru/title.jpg"/>
													</td>
												</tr>
											</table>
											<img width="756" height="1" src="/images/dazru/1x1.gif"/>
										</td>
									</tr>
								</table>
							</td>
						</tr>
		    		</table>
		    	</div>
	            <div class="">
	                <xsl:apply-templates select="content" />
	                <br class="spacer"/>
	            </div>
		    </body>
		</html>
	</xsl:template>
	
	<xsl:template name="Messages">
        <xsl:if test="Main/form/@sent = 1">
            <div>
                <xsl:if test="Main/form/@error = 1">
                    <xsl:attribute name="class">massage_no</xsl:attribute>
                </xsl:if>
                <xsl:if test="Main/form/@error = 0">
                    <xsl:attribute name="class">massage_yes</xsl:attribute>
                </xsl:if>
                <xsl:value-of select="Main/form/@message" />
            </div>
        </xsl:if>
    </xsl:template>
    
    <!-- Write.Date -->
    <xsl:template name="Write.Date">
        <xsl:param name="node"></xsl:param>
        <xsl:choose>
            <xsl:when test="$node/@day = $Date/@day and $node/@dmonth = $Date/@dmonth and $node/@year = $Date/@year">
                Сьогодні
            </xsl:when>
            <xsl:when test="$node/@day = $Date/@day+1 and $node/@dmonth = $Date/@dmonth and $node/@year = $Date/@year">
                Вчора
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$node/@day"/>
                <xsl:text>.</xsl:text>
                <xsl:value-of select="$node/@dmonth"/>
                <xsl:text>.</xsl:text>
                <xsl:value-of select="$node/@year"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <!-- Write.Date.Time -->
	<xsl:template name="Write.Date.Time">
		<xsl:param name="node"></xsl:param>
		<xsl:call-template name="Write.Date">
		    <xsl:with-param name="node" select="$node"/>
		</xsl:call-template>
		<xsl:text> </xsl:text>
		<xsl:value-of select="$node/@hour"/>
		<xsl:text>:</xsl:text>
		<xsl:value-of select="$node/@minute"/>
	</xsl:template>
</xsl:stylesheet>